import {
  createRouter,
  createWebHistory
} from 'vue-router'

const routes = [
  {
    path: '/',
    component: () => import('@/views/index.vue'),
    name: 'index',
    children: [
      {
        path: '/',
        name: 'main',
        component: () =>
          import('@/views/main_page.vue')
      },
      {
        path: 'article/:id',
        name: 'article',
        component: () =>
          import('@/views/article.vue')
      },
      {
        path: 'note/:id',
        name: 'note',
        component: () =>
          import('@/views/note.vue')
      },
      {
        path: 'category/:id',
        name: 'category',
        component: () =>
          import('@/views/items.vue')
      },
      {
        path: 'search',
        name: 'search',
        component: () =>
          import('@/views/items.vue')
      }
    ]
  }
]

const router = createRouter({
  history: createWebHistory(
    import.meta.env.BASE_URL
  ),
  routes
})

export { router, routes }
export default router
